
                            <div class="layui-card homepage-bottom">
                                <div class="layui-card-header">
                                    <h3 class="panel-title">
                                        <i class="layui-icon layui-icon-website"></i>
                                        核对文件
                                    </h3>
                                </div>
                                <div class="layui-card-body">
                                    <div class="panel-body layadmin-homepage-shadow">

                                        <div class="col-md-12">
                                            <div class="with-padding">
                                                <div class="alert alert-info">
                                                    <p>当前需要升级的版本<span style="color: red">v{$Think.session.nextVersion.version}</span></p>
                                                    <p>当前的系统版本号<span style="color: red">v{$Think.config.setting.version}</span></p>
                                                </div>
                                                <p><strong class="text-success">1.下载更新包 <i class="fa fa-forward"></i> 2.文件对比 <i
                                                        class="fa fa-forward"></i> 3.代码升级 <i class="fa fa-forward"></i></strong>4.数据库升级
                                                    <i class="fa fa-forward"></i> 5.升级版本号</p>
                                                <div id="message"
                                                     style="border: 1px solid #ccc;padding: 20px;height: 360px;overflow: auto">
                                                </div>
                                                <p>
                                                    备份文件存放位置：{:\\think\\facade\\Config::get('system_update_path')}{$Think.session.nextVersion.version}{$Think.DIRECTORY_SEPARATOR}backup{$Think.DIRECTORY_SEPARATOR}</p>

                                                <a id="compare_btn"    lay-href="admin/Version/updb" target="_self" class="layui-btn layui-btn-fluid"
                                                    data-title='文件覆盖完成，导入数据库。' disabled="disabled">文件覆盖完成，导入数据库。</a>
                                                <div style="margin-top: 10px">
                                                    <div class="progress progress-striped active hide" style="border-radius: 3px">
                                                        <div id="progress" class="progress-bar progress-bar-success"
                                                             role="progressbar" aria-valuenow="40"
                                                             aria-valuemin="0" aria-valuemax="100" style="width:0">
                                                        </div>
                                                    </div>
                                                </div>

                                            </div>


                                        </div>
                                    </div>

                                </div>
                            </div>

<script>
    layui.use(['admin'], function () {
        var $ = layui.$
            , admin = layui.admin;

        function getFile(data) {
            $.ajax({
                type: "POST",
                url: "{:url('cover')}",
                data: data,
                //返回数据的格式
                datatype: "json",
                success: function (result) {
                    if ('message' == result.type) {
                        $('#message').append(result.message);
                        var scrollTop = $("#message")[0].scrollHeight;
                        $("#message").scrollTop(scrollTop);
                    }
                    if (1 == result.is_end) {
                        $('#compare_btn').removeAttr('disabled', '');
                    }
                    if (0 == result.code) {
                        getFile(result);
                    } else {
                        //提醒
                    }
                },
                error: function (g) {
                    //	$(this).alertmsg('error','结算请求异常，请稍后再试！');
                    return;
                }
            });
        }

        var data = 'version={$Think.session.nextVersion.version}';
        getFile(data);

        function writeFile($data) {
            $('#file').append('<div><i class="icon-file"></i> ' + $data + '</div>');
        }

        function writeMessage($data) {
            $('#message').append($data);
        }

        function replaceMessage($data) {
            $('#message').children().last().remove();
            $('#message').children().last().remove();
            $('#message').append($data);
        }

        var progress = {
            'show': function () {
                $('#progress').parent().show();
            },
            'setValue': function ($value) {
                $('#progress').css('width', $value);
            },
            'hide': function () {
                $('#progress').parent().hide();
            }
        };
    });
</script>



